﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <script src="./jquery-3.5.1/jquery-3.5.1.min.js"></script>
  <script src="./js/http.js"></script>
  <script>
    const port =13333
    const $url = "http://127.0.0.1:" + port

    
    let resss
    async function gethttp(){
        resss = await http(
            {
            url: $url+"/queryAll_data",
            type: "GET",
            data: {},
            header:{contextType: "application/json"},
        })
        // console.log(37,resss)
        var str = "";
        for (var i in resss.data) {                
            str += "<tr><td>" + resss.data[i].name + "</td>";
            str += "<td>" + resss.data[i].sex + "</td>";
            str += "<td>" + resss.data[i].age + "</td>";
            str += "<td>" + resss.data[i].password + "</td>";
            str += "<td></td></tr>";            
        }
        $("#tableContext").html(str); 
        
    }
    gethttp()

    
    // $.ajax({
    //   url: $url+"/queryAll_data",
    //   type: "GET",   
    //     success: function (bbb) {
    //         var str = "";
    //         for (var i in bbb.data) {                
    //             str += "<tr><td>" + bbb.data[i].name + "</td>";
    //             str += "<td>" + bbb.data[i].sex + "</td>";
    //             str += "<td>" + bbb.data[i].age + "</td>";
    //             str += "<td>" + bbb.data[i].password + "</td>";
    //             str += "<td></td></tr>";            
    //         }
    //         $("#tableContext").html(str);         
    //   },
    //   error: function (err) {
    //   }
    // });
  </script>
</head>
<body>
    <div>
        <table>
            <thead>
                <tr>
                    <th>名字</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>密码</th>                   
                    <th>操作</th>
                </tr>
            </thead>
            <tbody id="tableContext"></tbody>            
        </table>
    </div>
    <div>
        <input type="button" value="详情" />
        <input type="button" value="删除" />
        <input type="button" value="修改" />
        <input type="button" value="添加" onclick="window.location.href = 'add.html';" />
    </div>
</body>
</html>